// 引入Service和请求头ServiceName
import { Service, ServiceName } from '@/network/http.js'
import store from '@/store/index.js' // 引入store

const api = {
  // 查询作业计划
  queryall (params) {
    return Service.get(
      `/${ServiceName}/api/external/DynamiCmonitor/queryall`, { params }
    )
  },
  // 已派劳务 熏蒸
  queryById (params) {
    return Service.get(
      `/${ServiceName}/api/external/DynamiCmonitor/queryById`, { params }
    )
  },
  // 已配工机械
  queryMechanicalDispatch (params) {
    return Service.get(
      `/${ServiceName}/api/external/DynamiCmonitor/queryMechanicalDispatch?id=${params}`,
    )
  },
  // 开工 完工 停工 复工
  updateById (params) {
    store.commit('changeStatus', true)
    return Service.put(
      `/${ServiceName}/api/external/DynamiCmonitor/updateById`, params
    )
  },
  // 详情
  queryWorkPlanDynamic (params) {
    return Service.get(
      `/${ServiceName}/api/external/DynamiCmonitor/queryWorkPlanDynamic?planId=${params}`,
    )
  },
  // 撤回
  updateStatus (params) {
    return Service.get(
      `/${ServiceName}/api/external/DynamiCmonitor/updateStatus?planId=${params}`,
    )
  },
}
export default api